<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>back/main/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>back/main/css/main.css"/>
    <script type="text/javascript" src="<%=basePath%>back/main/js/libs/modernizr.min.js"></script>
    <script src="<%=basePath%>js/jquery.js"></script>
</head>
<body>
<div class="crumb-wrap">
    <div class="crumb-list"><i class="icon-font"></i><span class="crumb-name">新增作品</span></div>
</div>
<div class="result-content">
    <form action="<%=basePath%>pri/back/menuinsert" method="post" id="myform" name="myform" enctype="multipart/form-data">
        <table class="insert-tab" width="100%">
            <tbody><tr>
                <th width="120"><i class="require-red">*</i>分类：</th>
                <td>
                    <select name="typeId" id="typeId" class="required">

                    </select>
                </td>
            </tr>
            <tr>
                <th><i class="require-red">*</i>标题：</th>
                <td>
                    <input class="common-text required" id="title" name="title" size="50" value="" type="text">
                </td>
            </tr>

            <tr>
                <th><i class="require-red">*</i>缩略图：</th>
                <td><input name="myfile" id="" type="file"><!--<input type="submit" onclick="submitForm('/jscss/admin/design/upload')" value="上传图片"/>--></td>
            </tr>
            <tr>
                <th>内容：</th>
                <td><textarea name="content" class="common-textarea" id="content" cols="30" style="width: 98%;" rows="10"></textarea></td>
            </tr>
            <tr>
                <th></th>
                <td>
                    <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                </td>
            </tr>
            </tbody></table>
    </form>
</div>
</body>
</html>
<script>
    $.ajax( {
        url:'<%=basePath%>pri/back/gettypes',
        type:'post',
        data: {

        },
        datatype : "json",//"xml", "html", "script", "json", "jsonp", "text".
        success : function(data) {
//            [
//                {"id":5,"typeName":"热菜","intro":"热菜"},
//                {"id":6,"typeName":"234","intro":"234"},
//                {"id":7,"typeName":"234","intro":"234"}
//            ]
            $.each(data, function (n, item) {
                var typeId=item.id;
                var typeName=item.typeName;
                var str="<option value='"+typeId+"'>"+typeName;
                $("#typeId").append(str);

            });

        }
    });
</script>
